require 'View.Base.BaseView'

SetShowModelBlendBones = class('SetShowModelBlendBones', BaseView)
SetShowModelBlendBones.ModelNum = 0

function SetShowModelBlendBones:OnShow()
    BaseView.OnDestroy(self)
    self:OnActive()
end

function SetShowModelBlendBones:OnHide()
    SetShowModelBlendBones.ModelNum = SetShowModelBlendBones.ModelNum - 1
    SetShowModelBlendBones.SetBlendBones()
    BaseView.OnHide(self)
end

function SetShowModelBlendBones:OnActive()
    SetShowModelBlendBones.ModelNum = SetShowModelBlendBones.ModelNum + 1
    SetShowModelBlendBones.SetBlendBones()
end

function SetShowModelBlendBones.SetBlendBones()
    if SetShowModelBlendBones.ModelNum == 0 then
        pcall(function()
            UnityEngine.QualitySettings.blendWeights = UnityEngine.BlendWeights.OneBone
        end)
    else
        pcall(function()
            UnityEngine.QualitySettings.blendWeights = UnityEngine.BlendWeights.FourBones
        end)
    end
end